<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="admin/css/style.css" />
<link rel="stylesheet" type="text/css" media="all" href="admin/css/niceforms-default.css" />
<script type="text/javascript" src="admin/js/jquery.min.js"></script>
<script type="text/javascript" src="admin/js/ddaccordion.js"></script>
<script src="admin/js/jquery.jclock-1.2.0.js" type="text/javascript"></script>
<script src="admin/js/jconfirmaction.jquery.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript" src="admin/js/niceforms.js"></script>
<script type="text/javascript">
ddaccordion.init({
	headerclass: "submenuheader", //Shared CSS class name of headers group
	contentclass: "submenu", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [1], //index of content(s) open by default [index1, index2, etc] [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["suffix", "<img src='admin/images/plus.gif' class='statusicon' />", "<img src='admin/images/minus.gif' class='statusicon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
});
</script>
<script type="text/javascript">
$(function($) {
    $('.jclock').jclock();
    
    if("error"=="${messageReturn}"){
		$("#error").html("添加信息出错，请重试");
	}
});

function validate(){
	
	var pdId = $("#pdId").val();
	var pdName = $("#pdName").val();
	var pdValue = $("#pdValue").val();
	var pdDesc = $("#pdDesc").val();
	
	var pattern = /^(\w+|[\u4e00-\u9fa5]+)(:\/\/)*(\w+.|\w+\/)*(\w+|[\u4e00-\u9fa5]+)$/;
	//alert(pdId + " "+pdName+"  "+pdValue+ "  "+pdDesc);
	
	if(!pattern.exec(pdId)){
		$("#error").html("请输入有效参数标识");
		return;
	}
	if(!pattern.exec(pdName)){
		$("#error").html("请输入有效参数名称");
		return;
	}
	if(!pattern.exec(pdValue)){
		$("#error").html("请输入有效参数值");
		return;
	}
	if(!pattern.exec(pdDesc)){
		$("#error").html("请输入有效参数描述");
		return;
	}
	
	$("#error").html("");
	$("#addForm").submit();
	
}
</script>
</head>
<body>
<div id="main_container">
       <%@include file="../header.jsp"%>
    <div class="main_content">
        <%@include file="menu.jsp"%>
   		 <div class="center_content">  
  		  <div class="left_content">
  				   <%@include file="sidebarmenu_sys.jsp"%>
    	  </div>  
	      <div class="right_content">
    		  <h5>当前位置: 系统管理 &gt; 其他管理 &gt; 添加系统参数</h5>  
   		 	<div class="form">
    		  <form id="addForm" action="paramAction!addParamDetailAction" method="post" class="niceform">
                <fieldset>
					<dl>
						<dt class="lf"><label for="pdId">参数类型:</label></dt>
                     	<dd class="inline">
                     		<select id="ptId" name="ptId">
                     			<c:forEach items="${allTypes}" var="t">
									<option value="${t.paramTypeId}">${t.name}</option>
                     			</c:forEach>
                     		</select>
                     	</dd>
                     	<dt><span class="error line" id="error"><s:fielderror fieldName="error"></s:fielderror></span></dt>
					</dl>
                    <dl>
                        <dt class="lf"><label for="pdId">参数标识：</label></dt>
                     	<dd class="inline"><input type="text" name="pdId" id="pdId" size="26" value="${pdId}"/></dd>
                        <dt class="lf"><label for="pdName">参数名称：</label></dt>
                      	<dd class="inline"><input type="text" name="pdName" id="pdName" size="26" value="${pdName}"/></dd>
                    </dl>
                    <dl>
                        <dt class="lf"><label for="pdValue"> 参 数 值  ：</label></dt>
                     	<dd class="inline"><input type="text" name="pdValue" id="pdValue" size="26" value="${pdValue}"/></dd>
                        <dt class="lf"><label for="pdDesc">参数描述：</label></dt>
                      	<dd class="inline"><input type="text" name="pdDesc" id="pdDesc" size="26" value="${pdDesc}" /></dd>
                    </dl>
                    <dl>
                 		 <dd class="bt">
                            <input type="button" value="添加" onclick="validate();" />
                       </dd>
                    </dl>
                 </fieldset>
             </form>
   		 	</div> 
        	
   	</div>  <!-- end of right content -->
                    
  </div>   <!--end of center content -->               
                    
    
    
    <div class="clear"></div>
    </div> <!--end of main content-->
	
   <%@include file="../footer.jsp" %>
      
</div>		
</body>
</html>
